package org.jcnc.staffingsystem.module;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;

/**
 * @author 许轲
 * Created on 2024/2/20$
 */
public class ButtonHBox extends HBox {
    Button oneButton = new Button();
    Button twoButton = new Button();

    public ButtonHBox(String oneText, String twoText) {
        oneButton.setText(oneText);
        twoButton.setText(twoText);
        oneButton.setPrefWidth(80);
        twoButton.setPrefWidth(80);
        Region spacer = new Region();
        spacer.setPrefWidth(30);
        Region spacer1 = new Region();
        spacer1.setPrefWidth(35);
        this.setAlignment(Pos.CENTER);
        this.getChildren().addAll(spacer1, oneButton, spacer, twoButton);
    }

    public void setOneAction(EventHandler<ActionEvent> event) {
        oneButton.setOnAction(event);
    }

    public void setTwoAction(EventHandler<ActionEvent> event) {
        twoButton.setOnAction(event);
    }

}
